package com.nondo.rdp.finance.domain.analysis;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.core.domain.base.BaseEntity;
import com.nondo.rdp.finance.config.DbConfig;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.util.Date;

/**
 * 金融圈-分析-评论
 */
@Entity
@Table(name = DbConfig.DEFAULT_TABLE_PREFIX + "analysis_comment")
public class AnalysisComment extends BaseEntity {
    private Long id;        //自增ID
    private Analysis analysis;  //评论的圈子
    private User user;      //评论用户
    private String body; //回复内容
    private String coment;   //作者回复
    private long upNum; //点赞数量
    private Date authorComentDate;//作者回复时间

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "aid")
    public Analysis getAnalysis() {
        return analysis;
    }

    public void setAnalysis(Analysis analysis) {
        this.analysis = analysis;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "uid")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getComent() {
        return coment;
    }

    public void setComent(String coment) {
        this.coment = coment;
    }

    @Column(columnDefinition = "int default 0")
    public Long getUpNum() {
        return upNum;
    }

    public void setUpNum(Long upNum) {
        this.upNum = upNum;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    public Date getAuthorComentDate() {
        return authorComentDate;
    }

    public void setAuthorComentDate(Date authorComentDate) {
        this.authorComentDate = authorComentDate;
    }
}
